{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "\n",
    "第一个updata\n",
    "net (1,128,32,48)\n",
    "inp(1,128,32,48)\n",
    "flow(1,2,32,48)\n",
    "corr(1,36,32,48)\n",
    "motion_features = self.encoder(flow, corr)#motion_features(1,128,32,48)\n",
    "        inp = F.concat([inp, motion_features], axis=1)#inp(1,256,32,48)\n",
    "        \n",
    "        net = self.gru(net, inp)#net(1,128,32,48)inp(1,256,32,48)=>net(1,128,32,48)\n",
    "        delta_flow = self.flow_head(net)#net(1,128,32,48)=> delta_flow(1,2,32,48)\n",
    "        mask = 0.25 * self.mask(net)#net(1,128,32,48)=>mask(1,144,32,48)\n",
    "        return net, mask, delta_flow\n",
    "\n",
    "#CRESTEREO\n",
    "with amp.autocast(enabled=self.mixed_precision):\n",
    "                    net_dw16, up_mask, delta_flow = self.update_block(\n",
    "                        net_dw16, inp_dw16, out_corrs, flow_dw16\n",
    "                    )#net_dw16(1,128,32,48),up_mask(1,144,32,48),delta_flow(1,2,32,48)\n"
   ],
   "metadata": {
    "collapsed": false,
    "is_executing": true
   },
   "id": "641548a54343aeb5"
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "                with amp.autocast(enabled=self.mixed_precision):\n",
    "                    net_dw8, up_mask, delta_flow = self.update_block(\n",
    "                        net_dw8, inp_dw8, out_corrs, flow_dw8\n",
    "                    )#net_dw8(1,128,64,96) inp_dw8(1,128,64,96) out_corrs(1,36,64,96)flow_dw8(1,2,64,96)\n",
    "                  def forward(self, net, inp, corr, flow, upsample=True):\n",
    "                        motion_features = self.encoder(flow, corr)#flow(1,2,64,96)corr(1,36,64,96)\n",
    "                        inp = F.concat([inp, motion_features], axis=1)\n",
    "                \n",
    "                        net = self.gru(net, inp)\n",
    "                        delta_flow = self.flow_head(net)\n",
    "                \n",
    "                        # scale mask to balence gradients\n",
    "                        mask = 0.25 * self.mask(net)\n",
    "                        return net, mask, delta_flow\n",
    "                    "
   ],
   "metadata": {
    "collapsed": false,
    "is_executing": true
   },
   "id": "e710ba2a42bc3339"
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "self.bias_convs = (\n",
    "            [M.Conv2d(self.context_dim, self.hidden_dim * 4, 3, padding=3 // 2) for i in\n",
    "             range(4)] )"
   ],
   "metadata": {
    "collapsed": false,
    "is_executing": true
   },
   "id": "ce86747accb996f8"
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false
   },
   "id": "a8e3135f116ba40"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
